package fields;

public class Shipping extends Ownable {
	private int baseRent;
	
	public Shipping(int number, String name, int price, int baseRent) {
		super(number, name, price);
		this.baseRent = baseRent;
	}

	@Override
	public int getRent() {
		int ownedShippings = 0;
		if(this.owner != null){
			for(Field f : this.owner.getOwned()){
				if(f instanceof Shipping) ownedShippings++;
			}
		}
		return this.baseRent * (int)(Math.pow(2, ownedShippings - 1));
	}

	@Override
	public String toString() {
		return "Shipping[" + super.toString() + "" + "]";
	}
}